define(["jquery"],function($){
	function init(){
		var arrProduct = [];
		for(var i in $.cookie()){
			if(i.slice(0,7) == "product"){
				arrProduct.push($.cookie()[i]);
			}
		}
		var numProduct = 0
		var priceProduct = 0
		arrProduct.forEach(function(value){
			numProduct += ~~(JSON.parse(value).num);
			priceProduct += parseFloat((JSON.parse(value).price).replace("¥","")) * JSON.parse(value).num;
		})
		priceProduct = ~~(priceProduct * 100) / 100;
		$("#header #shopcar span")[0].innerHTML = numProduct;
		$("#header #shopcar span")[1].innerHTML = "¥" + priceProduct;
	}
	return {
		fn : init
	}
})